package com.koron.plan.web.maintainplan.bean.convertor;

import com.koron.plan.web.maintainplan.bean.entity.MaintainPlanDispatchBean;
import com.koron.plan.web.maintainplan.bean.vo.MaintainPlanDispatchDetailVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author twcao
 * @title: MaintainPlanDispatchConvertor
 * @projectName GDH_EAM_V2
 * @description: 派工信息
 * @date 2021/9/1718:17
 */
@Mapper(componentModel = "spring", uses = MaintainPlanDispatchMapper.class)
public interface MaintainPlanDispatchConvertor {

    /**
     * 前端保存
     * @param detailVO
     * @return
     */
    @Mappings({
            @Mapping(target = "leader", expression = "java(MaintainPlanDispatchMapper.ownerLeaderId(detailVO))"),
            @Mapping(target = "leaderName", expression = "java(MaintainPlanDispatchMapper.ownerLeaderName(detailVO))"),
            @Mapping(target = "outLeader", expression = "java(MaintainPlanDispatchMapper.outLeaderId(detailVO))"),
            @Mapping(target = "outLeaderName", expression = "java(MaintainPlanDispatchMapper.outLeaderName(detailVO))")
    })
    MaintainPlanDispatchBean detailVOToBean(MaintainPlanDispatchDetailVO detailVO);

    /**
     * 数据查询回显
     * @param detailVO
     * @return
     */
    @Mappings({
            @Mapping(target = "trackLeader", expression = "java(MaintainPlanDispatchMapper.trackerId(detailVO))"),
            @Mapping(target = "trackLeaderName", expression = "java(MaintainPlanDispatchMapper.trackerName(detailVO))"),
            @Mapping(target = "leader", expression = "java(MaintainPlanDispatchMapper.leaderId(detailVO))"),
            @Mapping(target = "leaderName", expression = "java(MaintainPlanDispatchMapper.leaderName(detailVO))")
    })
    MaintainPlanDispatchDetailVO detailWrapper(MaintainPlanDispatchDetailVO detailVO);
}
